﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;

namespace BLL.EarningService
{
    /// <summary>
    /// 根据时间段查询收入数据
    /// </summary>
    public class QueryEarningRecordByTimeTransaction : QueryEarningRecordTransaction
    {
        private DateTime beginDate;
        private DateTime endDate;

        public QueryEarningRecordByTimeTransaction(DateTime _BeginDate,DateTime _EndDate)
        {
            this.beginDate = _BeginDate;
            this.endDate = _EndDate;
        }

        public QueryEarningRecordByTimeTransaction(int _Year, int _Month)
        {
            beginDate = new DateTime(_Year, _Month, 1);
            endDate = new DateTime(_Year, _Month, ToolBox.GetEndDay(_Year, _Month));
        }

        public IList<T_EarningRecordsObject> Query()
        {
            base.Execute();
            IList<T_EarningRecordsObject> list = base.ResultList;
            list = list.Where(x => x.Db_EarningDate >= beginDate && x.Db_EarningDate <= endDate).ToList();
            return list;
        }
    }
}
